﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BASE;



public partial class xemdiem : System.Web.UI.Page
{
    public int count = 1;
    protected void Page_Load(object sender, EventArgs e)
    {
        //check dang nhap
        if (Utils.getStringSession("masv") == "")
        {
            Response.Redirect("/");
        }
        if (!IsPostBack)
        {
            entSinhVien entSV = new entSinhVien();
            busSinhVien busSV = new busSinhVien();
            entSV = busSV.getSinhVienByMaSV(Utils.getStringSession("masv"));
            lb_masv.Text = entSV.MaSinhVien;
            lb_ten.Text = entSV.Ho+" "+ entSV.Ten;
            lb_lop.Text = entSV.MaLop;
            lb_ngaysinh.Text = entSV.NgaySinh;

            //lay diem tbtl
            busDiem busD = new busDiem();
            List<entDiem> lst = new List<entDiem>();
            lst = busD.getDiemTBTL(Utils.getStringSession("masv"));
            if (lst.Count > 0)
            {
                lb_dtbtl.Text = lst[0].Diem.ToString();
            }
        }
        Session["menu"] = Constants.XEMDIEM;

    }

    protected void btn_xem_Click(object sender, EventArgs e)
    {
        pn_re.Controls.Clear();
        Diem_DiemControl C2 = (Diem_DiemControl)LoadControl("~/diem/DiemControl.ascx");
        C2.masv = Utils.getStringSession("masv");
        C2.nam = txt_nam.Text;
        C2.count = 1;
        pn_re.Controls.Add(C2);
    }
    protected void link_xem_Click(object sender, EventArgs e)
    {
        List<entDiem> lst = new List<entDiem>();
        busDiem busDiem = new busDiem();
        lst = busDiem.getNamHocHocKy(Utils.getStringSession("masv"));
        Diem_DiemControl C2;
        int count = 1;
        foreach (entDiem item in lst)
        {
             C2 = (Diem_DiemControl)LoadControl("~/diem/DiemControl.ascx");
             C2.masv = Utils.getStringSession("masv");
             C2.nam = item.NamHoc + item.HocKy ;
             C2.count = count;
             pn_re.Controls.Add(C2);
             count += C2.max;
        }
    }
   
    protected void link_xemCT_Click(object sender, EventArgs e)
    {
        Diem_DiemChuongTrinhDT C2 = (Diem_DiemChuongTrinhDT)LoadControl("~/diem/DiemChuongTrinhDT.ascx");
        pn_re.Controls.Add(C2);
    }
}